<template>
    <div class="ContractInfo" style="width: 100%;">
        <rui-form :form-options="formOptions" :label-width="120" :read-only="false" ref="formData">
            <template slot="brandName" slot-scope="{ key,data }">
                <div>{{data[key]}}</div>
            </template>
            <template slot="engineNo" slot-scope="{ key,data }">
                <div>{{data[key]}}</div>
            </template>
            <template slot="licensePlate" slot-scope="{ key,data }">
                <div>{{data[key]}}</div>
            </template>
            <template slot="styleName" slot-scope="{ key,data }">
                <div>{{data[key]}}</div>
            </template>
            <template slot="carVin" slot-scope="{ key,data }">
                <a @click="showContractDetial(data)">{{data[key]}}</a>
            </template>
        </rui-form>
    </div>
</template>

<script>
export default {
    props: {
        contractNo: {
            type: String,
            required: true
        }
    },
    data() {
        return {
            pageNo: 1,
            carType: "plateCar",
            carTypeName: "直营车",
            defines: [],
            formOptions: [
                {
                    isGroup: false,
                    grids: [
                        {
                            defineId: "defineData",
                            span: 8,
                            fields: ["brandName", "engineNo"],
                            slots: [
                                { key: "brandName", slotName: "brandName" },
                                { key: "engineNo", slotName: "engineNo" }
                            ]
                        },
                        {
                            defineId: "defineData",
                            span: 8,
                            fields: ["licensePlate", "styleName"],
                            slots: [
                                {
                                    key: "licensePlate",
                                    slotName: "licensePlate"
                                },
                                { key: "styleName", slotName: "styleName" }
                            ]
                        },
                        {
                            defineId: "defineData",
                            span: 8,
                            fields: ["carVin"],
                            slots: [{ key: "carVin", slotName: "carVin" }]
                        }
                    ]
                }
            ]
        };
    },

    mounted() {},
    methods: {
        updateData(data) {
            console.log("AssetDetails===updateData", data);
            if (!data) return;
            this.$refs.formData.updateFormData(data);
        },
        showContractDetial(params = {}) {
            params.contractNo = this.contractNo;

            console.log("clcik params", params);
            this.afs.newTab(
                this,
                "projects/basic/pages/contract/contract-inquiry/contract-inquiry-detial/page/AssetsInfoDetial/index",
                "查看资产详情",
                "ios-add",
                params,
                "assets-info-detial-" + this.pageNo,
                [],
                true
            );
            this.pageNo += 1;
        }
    }
};
</script>
